package cn.gson.springboot.controller.presalecontroller;

import cn.gson.springboot.model.vo.presalevo.Data;
import cn.gson.springboot.model.service.presaleservice.PsBusinessViewService;
import cn.gson.springboot.model.vo.presalevo.MonthInfo;
import cn.gson.springboot.model.vo.presalevo.TranslationVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.*;

@Controller
@RequestMapping("/businessView")
public class PsBusinessViewController {
    @Autowired
    PsBusinessViewService psBusinessViewService;

    /*统计各阶段的商机数量及转化率*/
    @RequestMapping("/business_stage_number")
    @ResponseBody
    public Map<String,Object> business_stage_number (Integer empId,Integer deptId,String time){
        Map<String,Object> map = new HashMap<>();
        map.put("stageNumber", psBusinessViewService.business_stage_number(empId,deptId,time));
        map.put("translation",  psBusinessViewService.translation(empId,deptId,time));
        return  map;
    }

    /*商机的所有阶段*/
    @RequestMapping("/all_stage")
    @ResponseBody
    public List<String> all_stage(){
        return psBusinessViewService.all_stage();
    }

    /**
     * 查询某年的月份
     * @param valueInfo
     * @return
     */
    @RequestMapping("/get_monthInfo")
    @ResponseBody
    public List<MonthInfo> getMonth(Integer valueInfo){
     return psBusinessViewService.getMonth(valueInfo);
    }

    /**
     *  新增商机数和赢单数
     */
    @RequestMapping("/business_month_count")
    @ResponseBody
    public Map<String,Object> business_month_count(Integer empId, Integer deptId,Integer year){
        return psBusinessViewService.business_month_count(empId,deptId,year);
    }
    /**
     * 某年某月每天
     * 新增商机数和赢单数
     */
    @RequestMapping("/business_day_count")
    @ResponseBody
    public Map<String,Object> business_day_count(Integer empId,Integer deptId,Integer year,Integer month){
        return psBusinessViewService.business_day_count(empId,deptId,year,month);
    }
    /**
     * 计算赢单率
     */
    @RequestMapping("/calculate_winning_rate")
    @ResponseBody
    public Map<String,Object> calculateWinningRate(Integer year,Integer month){
        return psBusinessViewService.calculateWinningRate(year,month);
    }

}
